/**************************************************************************************************
	$Header: /pub/cvsroot/mydns/src/mydns/status.c,v 1.3 2002/07/04 10:47:11 bboy Exp $
	status.c: Routine to output server status information.

	Copyright (C) 2002  Don Moore <bboy@bboy.net>

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at Your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
**************************************************************************************************/

#include "named.h"


/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	SERVER_STATUS
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void
server_status(void)
{
	char buf[BUFSIZ], *b = buf;
	time_t uptime = time(NULL) - Status.start_time;

	b += snprintf(b, sizeof(buf)-(b-buf), "%s %s, ", _("up"), strsecs(uptime));
	b += snprintf(b, sizeof(buf)-(b-buf), "%llu %s (%.0f/s), ", Status.requests, _("questions"),
					  Status.requests ? AVG(Status.requests, uptime) : 0.0);
	b += snprintf(b, sizeof(buf)-(b-buf), "%s, ", cache_status());

	if ((b-buf) > 2)												/* Trim trailing ", " */
		*(b-1) = *(b-2) = '\0';

	Notice("%s", buf);
}
/*--- server_status() ---------------------------------------------------------------------------*/

/* vi:set ts=3: */
